
package leetcode;

public class Q2455 {
    public int averageValue(int[] nums) {
        int res = 0;
        int count = 0;

        for (int i = 0; i < nums.length; i++) {
            if ((nums[i] % 3 == 0) && (nums[i] % 2 == 0)) {
                res += nums[i];
                count++;
            }
        }

        if (count == 0) {
            return 0;
        }

        return res / count;
    }

    public static void main(String[] args) {
        Q2455 sl = new Q2455();
        int[] nums = {1, 3, 6, 10, 12, 15};
        System.out.println(sl.averageValue(nums));
    }
}